<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>

        var num = 10;
        //判断是奇数还是偶数
        if (num % 2 === 0){
            console.log(num + "是偶数");
        }else{
            console.log(num + "是奇数");
        }

        //三目运算符
        num % 2 === 0 ? console.log(num + "是偶数") : console.log(num + "是奇数");



    </script>
</body>
</html>